﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="timeline.aspx.cs" Inherits="CPETwit.Web.Pages.timeline" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>CPE Meet - Timeline</title>
    <meta charset="utf-8">
    <link rel="stylesheet" href="res/css/t1_core.css" type="text/css" media="screen">
    <link rel="stylesheet" href="res/css/js-user-style.css" type="text/css" media="screen">
    <style charset="utf-8" class="lazyload">
        @import "res/css/t1_more.bundle.css";
    </style>
    <script type="text/javascript" src="res/js/jquery-1.7.1.min.js"></script>
    <!-- ppTextArea Plugin -->
    <script type="text/javascript" src="res/js/jquery.ppTextarea.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#TweetPost').ppTextarea({
                min: 00,
                max: 140,
                idMeter: 'tweet-counter',
                textMeter: '',
                idCheck: '',
                imgYes: '',
                imgNo: '',
                stop: true
            });
        }); 
    </script>
</head>
<%@ Import Namespace="CPETwit.Data.Entity" %>
    <% 
    /* Traitement du design
     * Sexe masculin => design bleu, 
     * féminin => design rose 
     */
    switch (((User)Session["login"]).sex)
    {
        case "M" : 
            Response.Write("<body class='body-male'>");
            break;
        case "F" : 
            Response.Write("<body class='body-female'>");
            break;
    }
    %>
    <form id="form1" runat="server">
    <div class="route-home" id="doc">
        <div class="topbar js-topbar">
            <div class="global-nav" data-section-term="top_nav">
                <div class="global-nav-inner">
                    <div class="container">
                        <ul class="nav js-global-actions" id="global-actions">
                            <li id="global-nav-home" class="home active" data-global-action="home"><a class="js-hover"
                                href="timeline.aspx" data-component-term="home_nav"><span class="new-wrapper"><i
                                    class="nav-home"></i><i class="nav-new"></i></span>Accueil </a></li>
                            <li class="people" data-global-action="connect"><a class="js-hover" href="Following.aspx"
                                data-component-term="connect_nav"><span class="new-wrapper"><i class="nav-people"></i>
                                    <i class="nav-new"></i></span>Connecter </a></li>
                            <li class="people" data-global-action="connect"><a class="js-hover" href="profil.aspx"
                                data-component-term="connect_nav"><span class="new-wrapper"><i class="nav-me"></i><i
                                    class="nav-new"></i></span>Profil </a></li>
                            <li class="people" data-global-action="connect"><a class="js-hover" href="apropos.aspx"
                                data-component-term="connect_nav"><span class="new-wrapper"><i class="nav-topics"></i>
                                    <i class="nav-new"></i></span>A Propos </a></li>
                        </ul>
                        <i class="cpetweet-topbar"></i>
                        <div class="pull-right">
                            <div class="form-search js-search-form" autocomplete="off" id="global-nav-search">
                                <span class="search-icon js-search-action"><i class="nav-search"></i></span>
                                
                                <asp:textbox  CssClass="search-input" id="q" runat="server"></asp:textbox>
                                <div class="dropdown-menu dropdown-menu-dark typeahead js-global-nav-dropdown">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="alert-messages" id="message-drawer">
            </div>
        </div>
        <div id="page-outer">
            <div id="page-container" class="wrapper home-container">
                <div id="page-node-home">
                    <div class="dashboard">
                        <div id="js-promptbird-dashboard-narrow-hook" data-component-term="promptbird_dashboard_placeholder"
                            class="component">
                        </div>
                        <div data-component-term="mini_home_profile" class="module mini-profile component">
                            <div class="flex-module profile-summary js-profile-summary">
                                <a href="Profil.aspx" class="account-summary account-summary-small">
                                    <div class="content">
                                        <div class="account-group js-mini-current-user">
                                            <%
                                        if (((User)Session["login"]).avatar != null)
                                        {
                                            /* Avatar de l'utilisateur */
                                            Response.Write("<img class='avatar size32' id='avatar_preview' src='ImgHandler.ashx?login=" + ((User)Session["login"]).login + "' />");
                                        }
                                        else
                                        {
                                            /* Avatar par défaut */
                                            Response.Write("<img class='avatar size32' id='avatar_preview' src='res/img/hf32.png' />");
                                        }
                                        
                                         %>
                                            <b class="fullname"><% Response.Write(((User)Session["login"]).name); %></b> <small class="metadata">Voir ma page de profil</small>
                                        </div>
                                    </div>
                                </a>
                            </div>
                            <div class="js-mini-profile-stats-container">
                                <ul class="stats js-mini-profile-stats">
                                    <li><a href="profil.aspx" data-element-term="tweet_stats"><strong>
                                        <asp:label runat="server" text="0" ID="nb_tweet"></asp:label>
                                    </strong> Tweets</a>
                                    </li>
                                    <li><a href="Following.aspx" data-element-term="Following_stats"><strong>
                                        <asp:label runat="server" ID="nb_abonnement" text="Label"></asp:label>
                                        </strong> Abonnements</a>
                                    </li>
                                    <li><a href="Followers.aspx" data-element-term="follower_stats"><strong>
                                        <asp:label runat="server" ID="nb_abonne" text="Label"></asp:label>
                                    </strong> Abonnés</a>
                                    </li>
                                </ul>
                            </div>
                            <div class="tweet-box tweet-user">
                                <div class="tweet-box">
                                    <div class="text-area">
                                        <div class="text-area-editor twttr-editor closing">
                                            <asp:TextBox ID="TweetPost" runat="server" CssClass="twitter-anywhere-tweet-box-editor"
                                                TextMode="MultiLine"></asp:TextBox>
                                            <ul class="autocomplete-container" style="width: 274px; top: 87px; left: 0px; visibility: hidden;">
                                            </ul>
                                        </div>
                                    </div>
                                    <div class="tweet-button-container">
                                        <div class="tweet-button-sub-container">
                                            
                                            <span class="metadata"> Twitter ? 
                                            <asp:CheckBox ID="CheckBox_twitterizer" runat="server" Text="" CssClass="metadata" /></span>
                                            <span style="opacity: 0;" class="tweetbox-counter-tipsy"></span>
                                            <div class="tweet-counter" id="tweet-counter">140</div>
                                            <asp:LinkButton ID="TweetButton" runat="server" Text="Tweeter" OnClick="TweetButton_Click"
                                                CssClass="tweet-button btn primary-btn"></asp:LinkButton>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div style="display: none;" data-component-term="japanese_ad" class="component">
                        </div>
                        <div data-component-term="footer" class="component">
                            <div class="module site-footer ">
                                <div class="flex-module">
                                    <div class="flex-module-inner js-items-container">
                                        <ul class="clearfix">
                                            <li class="copyright">© 2012 CPE Tweet by CPE School. See "A Propos" section for more
                                                details.</li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="content-main js-content-main breakable">
                        <div id="js-promptbird-below-black-bar-hook">
                        </div>
                        <div id="js-empty-timeline-recommendations-module-hook">
                        </div>
                        <div class="content-header js-stream-header">
                            <div class="header-inner">
                                <h2>
                                    <span class="content-header-buttons js-header-button-container"></span><span class="js-stream-title">
                                        Tweets</span><small class="view-toggler js-view-toggler"></small></h2>
                            </div>
                        </div>
                        <div class="stream js-stream-manager-container">
                            <div class="stream-manager js-stream-manager-container" id="home-stream-manager">
                                <div class="stream-title">
                                </div>
                                <div class="stream-container">
                                    <div media="true" data-component-term="stream" class="stream home-stream">
                                        <div class="js-stream-items stream-items" id="stream-items-id">
                                            <!-- DEBUT TEMPLATE TWEET -->
                                            <asp:ListView ID="ListTweetUtilisateurCourant" runat="server" 
                                                DataSourceID="ObjectDataSource1" onItemCreated="list_onItemCreated">
                                                <EmptyDataTemplate>
                                                    <div class="js-stream-item stream-item stream-item expanding-stream-item">
                                                        <span class="metadata">Pas encore de tweet l'ami !</span>
                                                    </div>
                                                </EmptyDataTemplate>
                                                <ItemTemplate>
                                                    <div class="js-stream-item stream-item stream-item expanding-stream-item">
                                                        <div class="tweet original-tweet js-stream-tweet js-actionable-tweet js-hover js-profile-popup-actionable js-original-tweet">
                                                            <i class="dogear"></i>
                                                            <div class="content">
                                                                <div class="stream-item-header">
                                                                    <a class="account-group js-account-group js-action-profile js-user-profile-link"
                                                                        href='profil.aspx?login=<%#Eval("creatorProperty.login")%>'>
                                                                        <img class="avatar js-action-profile-avatar" src='<%# "ImgHandler.ashx?login=" + Eval("creatorProperty.login") %>' runat="server" visible='<%# (Eval("creatorProperty.avatar") != null ) ? true : false %>' />
                                                                        <img class="avatar js-action-profile-avatar" src='res/img/hf48.png' runat="server" visible='<%# (Eval("creatorProperty.avatar") == null ) ? true : false %>' />
                                                                        <strong class="fullname js-action-profile-name">
                                                                            <%# Eval("creatorProperty.login")  %></strong> <span class="username js-action-profile-name">
                                                                                <s>@</s><b><%# Eval("creatorProperty.login")%></b></span></a><small class="time"><a
                                                                                    href="#" class="tweet-timestamp js-permalink"><span
                                                                                        class="_timestamp"><%  %></span></a></small><small><%# SecondsRemaining(Eval("tweetdate") as DateTime?)%></small><ul class="actions js-actions">
                                                                        <!--<li class="action-reply-container"><i class="action-reply"></i>
                                                                            <asp:LinkButton ID="ReplyLink" CssClass="with-icn js-toggle-rt" runat="server" Text="Répondre" />
                                                                        </li>-->
                                                                        <li runat="server" visible='<%# Eval("TwitterProperty.login") != (((User)Session["login"]).login ) ? true : false %>' class="action-rt-container"><i class="action-rt"></i>
                                                                           
                                                                            <asp:LinkButton  ID="HyperLink1" CssClass="with-icn js-toggle-rt" CommandArgument='<%# Eval("id") %>'
                                                                                runat="server" Text="Retweeter" OnClick="test" />
                                                                        </li>
                                                                        <li class="action-del-container"><a class="with-icn js-action-del" href="#" title="Supprimer">
                                                                            <i class="action-del"></i><b>Supprimer</b> </a></li>
                                                                    </ul>
                                                                </div>
                                                                <p class="js-tweet-text">
                                                                    <%# parseTweet(Eval("MessageProperty.contenu") as string) %>
                                                                </p>
                                                                <div id="Div1" class="context" runat="server" visible='<%# Eval("TwitterProperty.name") != Eval("CreatorProperty.name") ? true : false %>' >
                                                                    <span class="with-icn"><i class="sm-rt"></i>Retweeté par <a class="pretty-link js-user-profile-link"
                                                                        href="#"><b><%# Eval("TwitterProperty.name")%></b></a> </span>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </ItemTemplate>
                                                <LayoutTemplate>
                                                    <div id="itemPlaceholderContainer" runat="server" style="">
                                                        <span runat="server" id="itemPlaceholder" />
                                                    </div>
                                                </LayoutTemplate>
                                            </asp:ListView>
                                            <!-- FIN TEMPLATE TWEET -->
                                            <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetUserTimeline"
                                                TypeName="CPETwit.Web.Service.Implementation.TwitterService">
                                                <SelectParameters>
                                                    <asp:SessionParameter Name="user" SessionField="login" Type="Object" />
                                                </SelectParameters>
                                            </asp:ObjectDataSource>
                                            <asp:ObjectDataSource ID="ObjectDataSource3" runat="server" 
                                                SelectMethod="GetAllTweetsByTag" 
                                                TypeName="CPETwit.Web.Service.Implementation.TwitterService">
                                                <SelectParameters>
                                                    <asp:QueryStringParameter Name="tag" QueryStringField="q" Type="String" />
                                                </SelectParameters>
                                            </asp:ObjectDataSource>
                                            <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" 
                                                SelectMethod="GetAllTweetsByText" 
                                                TypeName="CPETwit.Web.Service.Implementation.TwitterService">
                                                <SelectParameters>
                                                    <asp:FormParameter FormField="q" Name="texte" Type="String" />
                                                </SelectParameters>
                                            </asp:ObjectDataSource>

                                            <!--Recherche par Texte-->
                                            <asp:ListView ID="ListView3" runat="server" DataSourceID="ObjectDataSource2">
                                                                                              
                                                <EmptyDataTemplate>
                                                    
                                                </EmptyDataTemplate>
                                                
                                                <ItemTemplate>
                                                    <div class="js-stream-item stream-item stream-item expanding-stream-item">
                                                        <div class="tweet original-tweet js-stream-tweet js-actionable-tweet js-hover js-profile-popup-actionable js-original-tweet">
                                                            <i class="dogear"></i>
                                                            <div class="content">
                                                                <div class="stream-item-header">
                                                                    <a class="account-group js-account-group js-action-profile js-user-profile-link"
                                                                        href='profil.aspx?login=<%#Eval("CreatorProperty.login")%>'>
                                                                        <img id="Img1" class="avatar js-action-profile-avatar" src='<%# "ImgHandler.ashx?login=" + Eval("creatorProperty.login") %>' runat="server" visible='<%# (Eval("creatorProperty.avatar") != null ) ? true : false %>' />
                                                                        <img id="Img2" class="avatar js-action-profile-avatar" src='res/img/hf48.png' runat="server" visible='<%# (Eval("creatorProperty.avatar") == null ) ? true : false %>' />
                                                                        <strong class="fullname js-action-profile-name">
                                                                            <%# Eval("CreatorProperty.login")%></strong> <span class="username js-action-profile-name">
                                                                                <s>@</s><b><%# Eval("CreatorProperty.login")%></b></span></a><small class="time"><a
                                                                                    href="#" class="tweet-timestamp js-permalink"><span
                                                                                        class="_timestamp"><%  %></span></a></small><small><%# SecondsRemaining(Eval("tweetdate") as DateTime?)%></small><ul class="actions js-actions">
                                                                        <!--<li class="action-reply-container"><i class="action-reply"></i>
                                                                            <asp:LinkButton ID="ReplyLink" CssClass="with-icn js-toggle-rt" runat="server" Text="Répondre" />
                                                                        </li>-->
                                                                        <li runar="server" visible='<%# Eval("TwitterProperty.login") != (((User)Session["login"]).login ) ? true : false %>' class="action-rt-container"><i class="action-rt"></i>

                                                                            <asp:LinkButton ID="HyperLink1" CssClass="with-icn js-toggle-rt" CommandArgument='<%# Eval("CreatorProperty.id") %>'
                                                                                runat="server" Text="Retweeter" OnClick="test" />
                                                                        </li>
                                                                        <li class="action-del-container"><a class="with-icn js-action-del" href="#" title="Supprimer">
                                                                            <i class="action-del"></i><b>Supprimer</b> </a></li>
                                                                    </ul>
                                                                </div>
                                                                <p class="js-tweet-text">
                                                                     <%# parseTweet(Eval("MessageProperty.contenu") as string) %>
                                                                </p>
                                                            </div>
                                                        </div>
                                                    </div>
                                                 
                                                </ItemTemplate>
                                                                                                
                                            </asp:ListView>
                                            <!--FIN Recherche par Texte-->

                                            <!--Recherche par Tag-->
                                            <asp:ListView ID="ListView4" runat="server" DataSourceID="ObjectDataSource3">
                                                                                              
                                                <EmptyDataTemplate>
                                                </EmptyDataTemplate>
                                                
                                                <ItemTemplate>
                                                    <div class="js-stream-item stream-item stream-item expanding-stream-item">
                                                        <div class="tweet original-tweet js-stream-tweet js-actionable-tweet js-hover js-profile-popup-actionable js-original-tweet">
                                                            <i class="dogear"></i>
                                                            <div class="content">
                                                                <div class="stream-item-header">
                                                                    <a class="account-group js-account-group js-action-profile js-user-profile-link"
                                                                        href='profil.aspx?login=<%#Eval("CreatorProperty.login")%>'>
                                                                        <img id="Img3" class="avatar js-action-profile-avatar" src='<%# "ImgHandler.ashx?login=" + Eval("creatorProperty.login") %>' runat="server" visible='<%# (Eval("creatorProperty.avatar") != null ) ? true : false %>' />
                                                                        <img id="Img4" class="avatar js-action-profile-avatar" src='res/img/hf48.png' runat="server" visible='<%# (Eval("creatorProperty.avatar") == null ) ? true : false %>' />
                                                                        <strong class="fullname js-action-profile-name">
                                                                            <%# Eval("CreatorProperty.login")%></strong> <span class="username js-action-profile-name">
                                                                                <s>@</s><b><%# Eval("CreatorProperty.login")%></b></span></a><small class="time"><a
                                                                                    href="#" class="tweet-timestamp js-permalink"><span
                                                                                        class="_timestamp"><%  %></span></a></small><small><%# SecondsRemaining(Eval("tweetdate") as DateTime?)%></small><ul class="actions js-actions">
                                                                        <!--<li class="action-reply-container"><i class="action-reply"></i>
                                                                            <asp:LinkButton ID="ReplyLink" CssClass="with-icn js-toggle-rt" runat="server" Text="Répondre" />
                                                                        </li>-->
                                                                        <li runar="server" visible='<%# Eval("TwitterProperty.login") != (((User)Session["login"]).login ) ? true : false %>' class="action-rt-container"><i class="action-rt"></i>

                                                                            <asp:LinkButton ID="HyperLink1" CssClass="with-icn js-toggle-rt" CommandArgument='<%# Eval("CreatorProperty.id") %>'
                                                                                runat="server" Text="Retweeter" OnClick="test" />
                                                                        </li>
                                                                        <li class="action-del-container"><a class="with-icn js-action-del" href="#" title="Supprimer">
                                                                            <i class="action-del"></i><b>Supprimer</b> </a></li>
                                                                    </ul>
                                                                </div>
                                                                <p class="js-tweet-text">
                                                                     <%# parseTweet(Eval("MessageProperty.contenu") as string) %>
                                                                </p>
                                                            </div>
                                                        </div>
                                                    </div>
                                                 
                                                </ItemTemplate>
                                                                                                
                                            </asp:ListView>
                                            <!--FIN Recherche par Tag-->
                                        </div>
                                        <div class="stream-loading">
                                            <div class="stream-end-inner">
                                                <asp:LinkButton ID="DisconnectButton" runat="server" OnClick="DisconnectButton_Click"
                                                CssClass="metadata">Se déconnecter</asp:LinkButton>
                                                <!-- <span class="spinner" title="Chargement..."></span> -->
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="twttr-dialog-wrapper">
            </div>
    </form>
</body>
</html>
